This repository was archived by the owner on Jan 26, 2022. It is now read-only.
Coerce lane indexes with ToNumber().#335
Open
stoklund wants to merge 3 commits intotc39:masterfrom
stoklund:lane-index
Open
Coerce lane indexes with ToNumber().#335stoklund wants to merge 3 commits intotc39:masterfrom stoklund:lane-index
stoklund wants to merge 3 commits intotc39:masterfrom
stoklund:lane-index
Conversation
Collaborator
|
I think you meant #329 instead of 319, right? |
SIMD functions that take a lane index (extractLane, replaceLane, swizzle, shuffle) should use ToNumber() to coerce the lane index to a number before checking that the index is an integer in range. This behavior corresponds to the SIMDToLane() function in the SIMD.js specification. This fixes issues #329 and #237.
Author
|
Oops, you are right. Fixed. |
| throw new RangeError('Lane index must be an integer'); | ||
| return index; | ||
| } | ||
|
|
Collaborator
There was a problem hiding this comment.
Maybe implement simdCoerceLaneIndex() using simdCoerceIndex(), just to avoid a little code duplication. It shouldn't matter that the index != Math.floor() check fails before the bounds check, I think.
Author
|
Thanks, Peter. I found another mistake in the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SIMD functions that take a lane index (extractLane, replaceLane, swizzle,
shuffle) should use ToNumber() to coerce the lane index to a number before
checking that the index is an integer in range.
This behavior corresponds to the SIMDToLane() function in the SIMD.js
specification.
This fixes issues #319 and #237.